﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Viet_Calculator
{
	/// <summary>
	/// Summary description for GiaiPhuongTrinhBac3.
	/// </summary>
	public class GiaiPhuongTrinhBac3 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.TextBox txtX3;
		private System.Windows.Forms.TextBox txtX2;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label25;
		private System.Windows.Forms.Label label26;
		private System.Windows.Forms.Label label14;
		private System.Windows.Forms.Label label15;
		private System.Windows.Forms.Label label13;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label label19;
		private System.Windows.Forms.Label label18;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label16;
		private System.Windows.Forms.Label label17;
		private System.Windows.Forms.TextBox txtC;
		private System.Windows.Forms.GroupBox groupBox4;
		private System.Windows.Forms.Button btnGiai;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox txtB;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox txtA;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label24;
		private System.Windows.Forms.Label label23;
		private System.Windows.Forms.Label label22;
		private System.Windows.Forms.Label label20;
		private System.Windows.Forms.Label label21;
		private System.Windows.Forms.Label label12;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public GiaiPhuongTrinhBac3()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(GiaiPhuongTrinhBac3));
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.txtX3 = new System.Windows.Forms.TextBox();
			this.txtX2 = new System.Windows.Forms.TextBox();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.label25 = new System.Windows.Forms.Label();
			this.label26 = new System.Windows.Forms.Label();
			this.label14 = new System.Windows.Forms.Label();
			this.label15 = new System.Windows.Forms.Label();
			this.label13 = new System.Windows.Forms.Label();
			this.label11 = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.label19 = new System.Windows.Forms.Label();
			this.label18 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label16 = new System.Windows.Forms.Label();
			this.label17 = new System.Windows.Forms.Label();
			this.txtC = new System.Windows.Forms.TextBox();
			this.groupBox4 = new System.Windows.Forms.GroupBox();
			this.btnGiai = new System.Windows.Forms.Button();
			this.label10 = new System.Windows.Forms.Label();
			this.label9 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.txtB = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.txtA = new System.Windows.Forms.TextBox();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.label24 = new System.Windows.Forms.Label();
			this.label23 = new System.Windows.Forms.Label();
			this.label22 = new System.Windows.Forms.Label();
			this.label20 = new System.Windows.Forms.Label();
			this.label21 = new System.Windows.Forms.Label();
			this.label12 = new System.Windows.Forms.Label();
			this.groupBox3.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.groupBox4.SuspendLayout();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.txtX3);
			this.groupBox3.Controls.Add(this.txtX2);
			this.groupBox3.Controls.Add(this.textBox1);
			this.groupBox3.Controls.Add(this.label25);
			this.groupBox3.Controls.Add(this.label26);
			this.groupBox3.Controls.Add(this.label14);
			this.groupBox3.Controls.Add(this.label15);
			this.groupBox3.Controls.Add(this.label13);
			this.groupBox3.Controls.Add(this.label11);
			this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox3.Location = new System.Drawing.Point(8, 440);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(744, 72);
			this.groupBox3.TabIndex = 11;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "Kết quả";
			// 
			// txtX3
			// 
			this.txtX3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtX3.Location = new System.Drawing.Point(616, 32);
			this.txtX3.Name = "txtX3";
			this.txtX3.ReadOnly = true;
			this.txtX3.Size = new System.Drawing.Size(120, 22);
			this.txtX3.TabIndex = 21;
			this.txtX3.Text = "";
			// 
			// txtX2
			// 
			this.txtX2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtX2.Location = new System.Drawing.Point(344, 32);
			this.txtX2.Name = "txtX2";
			this.txtX2.ReadOnly = true;
			this.txtX2.Size = new System.Drawing.Size(120, 22);
			this.txtX2.TabIndex = 20;
			this.txtX2.Text = "";
			// 
			// textBox1
			// 
			this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.textBox1.Location = new System.Drawing.Point(64, 32);
			this.textBox1.Name = "textBox1";
			this.textBox1.ReadOnly = true;
			this.textBox1.Size = new System.Drawing.Size(120, 22);
			this.textBox1.TabIndex = 19;
			this.textBox1.Text = "Giá trị dò nghiệm";
			// 
			// label25
			// 
			this.label25.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label25.Location = new System.Drawing.Point(40, 32);
			this.label25.Name = "label25";
			this.label25.Size = new System.Drawing.Size(16, 18);
			this.label25.TabIndex = 18;
			this.label25.Text = "=";
			// 
			// label26
			// 
			this.label26.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label26.Location = new System.Drawing.Point(8, 32);
			this.label26.Name = "label26";
			this.label26.Size = new System.Drawing.Size(24, 18);
			this.label26.TabIndex = 17;
			this.label26.Text = "x1";
			// 
			// label14
			// 
			this.label14.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label14.Location = new System.Drawing.Point(592, 32);
			this.label14.Name = "label14";
			this.label14.Size = new System.Drawing.Size(16, 18);
			this.label14.TabIndex = 16;
			this.label14.Text = "=";
			// 
			// label15
			// 
			this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label15.Location = new System.Drawing.Point(560, 32);
			this.label15.Name = "label15";
			this.label15.Size = new System.Drawing.Size(24, 18);
			this.label15.TabIndex = 14;
			this.label15.Text = "x3";
			// 
			// label13
			// 
			this.label13.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label13.Location = new System.Drawing.Point(320, 32);
			this.label13.Name = "label13";
			this.label13.Size = new System.Drawing.Size(16, 18);
			this.label13.TabIndex = 13;
			this.label13.Text = "=";
			// 
			// label11
			// 
			this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label11.Location = new System.Drawing.Point(288, 32);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(24, 18);
			this.label11.TabIndex = 11;
			this.label11.Text = "x2";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label19);
			this.groupBox2.Controls.Add(this.label18);
			this.groupBox2.Controls.Add(this.label8);
			this.groupBox2.Controls.Add(this.label16);
			this.groupBox2.Controls.Add(this.label17);
			this.groupBox2.Controls.Add(this.txtC);
			this.groupBox2.Controls.Add(this.groupBox4);
			this.groupBox2.Controls.Add(this.label10);
			this.groupBox2.Controls.Add(this.label9);
			this.groupBox2.Controls.Add(this.label7);
			this.groupBox2.Controls.Add(this.label6);
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Controls.Add(this.label3);
			this.groupBox2.Controls.Add(this.txtB);
			this.groupBox2.Controls.Add(this.label2);
			this.groupBox2.Controls.Add(this.label1);
			this.groupBox2.Controls.Add(this.txtA);
			this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox2.Location = new System.Drawing.Point(8, 328);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(744, 96);
			this.groupBox2.TabIndex = 10;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Giải phương trình";
			// 
			// label19
			// 
			this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label19.Location = new System.Drawing.Point(392, 64);
			this.label19.Name = "label19";
			this.label19.Size = new System.Drawing.Size(24, 18);
			this.label19.TabIndex = 19;
			this.label19.Text = "-5";
			// 
			// label18
			// 
			this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label18.Location = new System.Drawing.Point(296, 64);
			this.label18.Name = "label18";
			this.label18.Size = new System.Drawing.Size(16, 24);
			this.label18.TabIndex = 18;
			this.label18.Text = "+";
			// 
			// label8
			// 
			this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label8.Location = new System.Drawing.Point(232, 64);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(48, 18);
			this.label8.TabIndex = 17;
			this.label8.Text = "   3   x";
			// 
			// label16
			// 
			this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label16.Location = new System.Drawing.Point(296, 32);
			this.label16.Name = "label16";
			this.label16.Size = new System.Drawing.Size(16, 24);
			this.label16.TabIndex = 16;
			this.label16.Text = "+";
			// 
			// label17
			// 
			this.label17.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label17.Location = new System.Drawing.Point(264, 32);
			this.label17.Name = "label17";
			this.label17.Size = new System.Drawing.Size(16, 24);
			this.label17.TabIndex = 15;
			this.label17.Text = "x";
			// 
			// txtC
			// 
			this.txtC.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtC.Location = new System.Drawing.Point(328, 32);
			this.txtC.Name = "txtC";
			this.txtC.Size = new System.Drawing.Size(88, 22);
			this.txtC.TabIndex = 14;
			this.txtC.Text = "";
			this.txtC.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// groupBox4
			// 
			this.groupBox4.Controls.Add(this.btnGiai);
			this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox4.Location = new System.Drawing.Point(624, 24);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(112, 56);
			this.groupBox4.TabIndex = 13;
			this.groupBox4.TabStop = false;
			// 
			// btnGiai
			// 
			this.btnGiai.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.btnGiai.Location = new System.Drawing.Point(8, 16);
			this.btnGiai.Name = "btnGiai";
			this.btnGiai.Size = new System.Drawing.Size(96, 24);
			this.btnGiai.TabIndex = 0;
			this.btnGiai.Text = "Giải";
			this.btnGiai.Click += new System.EventHandler(this.btnGiai_Click);
			// 
			// label10
			// 
			this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label10.Location = new System.Drawing.Point(464, 64);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(16, 18);
			this.label10.TabIndex = 12;
			this.label10.Text = "0";
			// 
			// label9
			// 
			this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label9.Location = new System.Drawing.Point(432, 64);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(16, 18);
			this.label9.TabIndex = 11;
			this.label9.Text = "=";
			// 
			// label7
			// 
			this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label7.Location = new System.Drawing.Point(136, 64);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(16, 24);
			this.label7.TabIndex = 9;
			this.label7.Text = "+";
			// 
			// label6
			// 
			this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label6.Location = new System.Drawing.Point(72, 64);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(56, 18);
			this.label6.TabIndex = 8;
			this.label6.Text = "   8   x2";
			// 
			// label5
			// 
			this.label5.AutoSize = true;
			this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label5.Location = new System.Drawing.Point(8, 64);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(41, 18);
			this.label5.TabIndex = 7;
			this.label5.Text = "Ví dụ:";
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label4.Location = new System.Drawing.Point(464, 32);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(16, 24);
			this.label4.TabIndex = 5;
			this.label4.Text = "0";
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label3.Location = new System.Drawing.Point(432, 32);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(16, 24);
			this.label3.TabIndex = 4;
			this.label3.Text = "=";
			// 
			// txtB
			// 
			this.txtB.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtB.Location = new System.Drawing.Point(168, 32);
			this.txtB.Name = "txtB";
			this.txtB.Size = new System.Drawing.Size(88, 22);
			this.txtB.TabIndex = 3;
			this.txtB.Text = "";
			this.txtB.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label2.Location = new System.Drawing.Point(136, 32);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(16, 24);
			this.label2.TabIndex = 2;
			this.label2.Text = "+";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label1.Location = new System.Drawing.Point(104, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(24, 24);
			this.label1.TabIndex = 1;
			this.label1.Text = "x2";
			// 
			// txtA
			// 
			this.txtA.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.txtA.Location = new System.Drawing.Point(8, 32);
			this.txtA.Name = "txtA";
			this.txtA.Size = new System.Drawing.Size(88, 22);
			this.txtA.TabIndex = 0;
			this.txtA.Text = "";
			this.txtA.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.label24);
			this.groupBox1.Controls.Add(this.label23);
			this.groupBox1.Controls.Add(this.label22);
			this.groupBox1.Controls.Add(this.label20);
			this.groupBox1.Controls.Add(this.label21);
			this.groupBox1.Controls.Add(this.label12);
			this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox1.Location = new System.Drawing.Point(8, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(744, 304);
			this.groupBox1.TabIndex = 9;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Hướng dẫn";
			// 
			// label24
			// 
			this.label24.Location = new System.Drawing.Point(8, 256);
			this.label24.Name = "label24";
			this.label24.Size = new System.Drawing.Size(728, 40);
			this.label24.TabIndex = 6;
			this.label24.Text = "Các bạn hãy giải phương trình bậc 2 (8x2 + 3x - 5) để tìm ra 2 nghiệm còn lại của" +
				" phương trình bậc 3 (8x3 - 5x2 - 8x + 5). Chúc các bạn thành công!";
			// 
			// label23
			// 
			this.label23.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label23.Location = new System.Drawing.Point(8, 224);
			this.label23.Name = "label23";
			this.label23.Size = new System.Drawing.Size(728, 24);
			this.label23.TabIndex = 5;
			this.label23.Text = "(8x3 - 5x2 - 8x + 5) / (x - 1) = 8x2 + 3x - 5  ";
			// 
			// label22
			// 
			this.label22.Location = new System.Drawing.Point(8, 152);
			this.label22.Name = "label22";
			this.label22.Size = new System.Drawing.Size(728, 64);
			this.label22.TabIndex = 4;
			this.label22.Text = @"Với phương trình bậc 3: 8x3 - 5x2 - 8x + 5 = 0 các bạn có thể thấy x = 1 là một nghiệm của phương trình bậc 3.  Từ đây chúng ta có thể viết được phương trình bậc 1 là: x - 1 = 0. Để tìm được phương trình bậc 2 chúng ta chỉ cần lấy phương trình bậc 3 (8x3 - 5x2 - 8x + 5) chia cho phương trình bậc 1 (x - 1). Nếu các bạn không biết cách chia như thế nào thì mình xin chịu thua!";
			// 
			// label20
			// 
			this.label20.Location = new System.Drawing.Point(8, 104);
			this.label20.Name = "label20";
			this.label20.Size = new System.Drawing.Size(728, 48);
			this.label20.TabIndex = 3;
			this.label20.Text = @"Để có thể tách phương trình này thành 1 phương trình bậc 1 và 1 phương trình bậc 2, các bạn hãy dùng biện pháp dò nghiệm. Các bạn hãy thay giá trị x bằng các giá trị 1, -1, 2, -2, 3, -3... Nếu giá trị nào làm cho phương trình bậc 3 bằng 0 thì đó là 1 nghiệm của phương trình! ";
			// 
			// label21
			// 
			this.label21.Location = new System.Drawing.Point(8, 80);
			this.label21.Name = "label21";
			this.label21.Size = new System.Drawing.Size(728, 24);
			this.label21.TabIndex = 2;
			this.label21.Text = "Ví dụ với phương trình bậc 3:  8x3 - 5x2 - 8x + 5 = 0";
			// 
			// label12
			// 
			this.label12.Location = new System.Drawing.Point(8, 32);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(728, 48);
			this.label12.TabIndex = 0;
			this.label12.Text = "Để có thể giải được phương trình bậc 3 một cách thành công, mình rất cần có sự hợ" +
				"p tác từ phía các bạn! Cụ thể chúng ta cần tách  phương trình bậc 3 thành 1 phươ" +
				"ng trình bậc 1 và 1 phương trình bậc 2!";
			// 
			// GiaiPhuongTrinhBac3
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(762, 528);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "GiaiPhuongTrinhBac3";
			this.Text = "Giai Phuong Trinh Bac 3";
			this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
			this.groupBox3.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion


		// Giải phương trình bậc 3
		private void btnGiai_Click(object sender, System.EventArgs e)
		{
			if (txtA.Text == "")
			{
				MessageBox.Show("Các bạn hãy điền vào ô trống giá trị A!");
			}
			
			else if (txtB.Text == "")
			{
				MessageBox.Show("Các bạn hãy điền vào ô trống giá trị B!");
			}

			else if (txtC.Text == "")
			{
				MessageBox.Show("Các bạn hãy điền vào ô trống giá trị C!");
			}

			else
			{
				try
				{
					double dblGiaTriA = Convert.ToDouble(txtA.Text);
					double dblGiaTriB = Convert.ToDouble(txtB.Text);
					double dblGiaTriC = Convert.ToDouble(txtC.Text);
					double dblGiaTriX2, dblGiaTriX3;

					double dblDelta = (dblGiaTriB*dblGiaTriB) - (4*dblGiaTriA*dblGiaTriC);
					double dblCanDelta = Math.Sqrt(dblDelta);

					if (dblGiaTriA != 0)
					{
						dblGiaTriX2 = (((1-2)*dblGiaTriB) + dblCanDelta)/(2*dblGiaTriA);
						dblGiaTriX3 = (((1-2)*dblGiaTriB) - dblCanDelta)/(2*dblGiaTriA);

						txtX2.Text = dblGiaTriX2.ToString();
						txtX3.Text = dblGiaTriX3.ToString();
					}

					else
					{
						txtX2.Clear();
						txtX3.Clear();
						MessageBox.Show("Phương trình vô nghiệm!");
					}
				}
				
				catch (Exception ex)
				{
					MessageBox.Show("Đã có lỗi xảy ra! Các bạn hãy kiểm tra lại xem mình đã thao tác đúng chưa nhé!", ex.Source);
				}
			}
		}
	}
}
